package com.company.cloud.pay.modules.api.fallback;

import com.company.cloud.common.bean.BaseClientResult;
import com.company.cloud.pay.modules.api.request.*;
import com.company.cloud.pay.modules.api.response.*;
import com.company.cloud.pay.modules.api.service.PayRemoteService;
import feign.hystrix.FallbackFactory;
import lombok.extern.log4j.Log4j2;
import org.springframework.stereotype.Component;

@Log4j2
@Component
public class PayRemoteServiceFallbackFactory implements FallbackFactory<PayRemoteService> {

    @Override
    public PayRemoteService create(Throwable cause) {
        return new PayRemoteService() {

            @SuppressWarnings("unchecked")
            @Override
            public BaseClientResult<PayOrderResponse> payOrderInfo(PayOrderRequest request) {
                return BaseClientResult.callbackError();
            }

            @SuppressWarnings("unchecked")
            @Override
            public BaseClientResult<PayOrderCancelResponse> payOrderCancel(PayOrderCancelRequest request) {
                return BaseClientResult.callbackError();
            }

            @SuppressWarnings("unchecked")
            @Override
            public BaseClientResult<PayOrderCloseResponse> payOrderClose(PayOrderCloseRequest request) {
                return BaseClientResult.callbackError();
            }

            @SuppressWarnings("unchecked")
            @Override
            public BaseClientResult<PayOrderQueryResponse> payOrderQuery(PayOrderQueryRequest request) {
                return BaseClientResult.callbackError();
            }

            @SuppressWarnings("unchecked")
            @Override
            public BaseClientResult<RefundOrderResponse> refundOrderInfo(RefundOrderRequest request) {
                return BaseClientResult.callbackError();
            }

            @SuppressWarnings("unchecked")
            @Override
            public BaseClientResult<RefundOrderQueryRequest> refundOrderQuery(RefundOrderQueryRequest request) {
                return BaseClientResult.callbackError();
            }


        };
    }

}
